<template>
  <div>
    <template v-if="spin">
      <a-spin :spinning="$store.state.app.loading">
        <keep-alive :max="max"
                    :include="include"
                    :exclude="exclude">
          <router-view v-if="$route.meta.keepAlive" />
        </keep-alive>
        <router-view v-if="!$route.meta.keepAlive" />
      </a-spin>
    </template>
    <template v-else>
      <keep-alive :max="max"
                  :include="include"
                  :exclude="exclude">
        <router-view v-if="$route.meta.keepAlive" />
      </keep-alive>
      <router-view v-if="!$route.meta.keepAlive" />
    </template>
  </div>
</template>

<script>
export default {
  name: 'RouteView',
  props: {
    max: {
      type: Number,
      default: null
    },
    spin: {
      type: Boolean,
      default: false
    },
    include: {
      type: String,
      default: null
    },
    exclude: {
      type: String,
      default: null
    }
  }
}
</script>

<style scoped>
</style>
